<template>
  <ve-bar :data="chartData" :extend="extend" :settings="chartSettings"></ve-bar>
</template>

<script>

export default {
  props: ['userId'],
  data () {
    this.chartSettings = {
      // opacity: 0.7
    }
    this.extend = {
      series: {
        label: { show: true, position: 'right' }
      }
    }
    return {
      chartData: {
        columns: ['MBTI倾向', '得分'],
        rows: [
          { MBTI倾向: '(J) 判断', 得分: 0 },
          { MBTI倾向: '(T) 思考', 得分: 0 },
          { MBTI倾向: '(S) 实感', 得分: 0 },
          { MBTI倾向: '(E) 外向', 得分: 0 }
        ]
      }
    }
  },
  created () {
    this.selectproresult()
  },
  methods: {
    selectproresult () {
      const params = {
        user_Id: this.userId,
        questionType_Id: 1
      }
      this.selectProresult(params)
        .then(data => {
          //   console.log(data.data[0])
          this.chartData.rows[0].得分 = JSON.parse(data.data[0].countScore).J
          this.chartData.rows[1].得分 = JSON.parse(data.data[0].countScore).T
          this.chartData.rows[2].得分 = JSON.parse(data.data[0].countScore).S
          this.chartData.rows[3].得分 = JSON.parse(data.data[0].countScore).E
          //   this.$emit('resultStrengthMBTI',data.data[0].resultStrength);
        })
    }
  }
}
</script>
